package com.oscarmovie.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oscarmovie.model.Country;

public class CountryDaoImpl extends HibernateDaoSupport implements CountryDao {

	public void save(Country country) {
		getSession().saveOrUpdate(country);
	}

	public Country load(int id) {
		Country country = (Country)getSession().load(Country.class, id);
		return country;
	}
	
	
	public List<Country> loadAll() {
		Query query = getSession().createQuery("from Country ");
		query.setCacheable(true);
		List<Country> list = (List<Country>)query.list();
		return list;
	}
	
}
